<?php
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
/**
 * 后台核心功能
 */
Route::group(['namespace' => 'Api\Admin\Core', 'prefix' => 'auth'], function () {
    Route::post('login', 'AuthController@login');
    Route::post('access-token', 'AuthController@getAccessToken');
});

Route::group(['middleware' => ['auth:api'], 'namespace' => 'Api\Admin\Core', 'prefix' => 'admin'], function () {
    //管理员
    Route::resource('admin', 'AdminController', [
        'except' => ['create', 'edit']
    ]);


    //获取当前登录人的个人信息
    Route::get('profile', 'AdminController@getProfile');
    Route::post('profile', 'AdminController@updateProfile');


    Route::post('reset-password/{id}', 'AdminManagerController@resetPassword');


    /**
     * 系统参数
     */
    Route::resource('property', 'PropertyController', ['except' => ['create', 'edit']]);


    Route::resource('option', 'OptionController', [
        'except' => ['create', 'edit', 'destroy']
    ]);


//个人中心
    Route::group(['prefix' => 'personal'], function () {
        Route::get('/', 'PersonalController@index');
        Route::get('create', 'PersonalController@create');
        Route::post('create', 'PersonalController@store');
        Route::get('update/{id}', 'PersonalController@edit');
        Route::post('update/{id}', 'PersonalController@update');
        Route::get('delete/{id}', 'PersonalController@getDelete');
    });



});

/**
 * CMS - 内容管理相关路由
 */
Route::group(['middleware' => ['auth:api'], 'namespace' => 'Api\Admin\CMS', 'prefix' => 'admin'], function () {
    /**
     *  导航管理
     */
    Route::resource('navigation', 'NavigationController', ['except' => ['create', 'edit']]);
    /**
     * 内容分类
     */
    Route::resource('category', 'CategoryController', ['except' => ['create', 'edit']]);
    Route::get('category-list', 'CategoryController@tableList');
    Route::get('category/check-content/{id}', 'CategoryController@checkContent');
    /**
     * 文章内容
     */
    Route::resource('content-blog', 'ContentBlogController', ['except' => ['create', 'edit']]);
    /**
     * 图片内容
     */
    Route::resource('content-picture', 'ContentPictureController', ['except' => ['create', 'edit']]);
    /**
     * 素材
     */
    Route::resource('asset', 'AssetController', ['except' => ['create', 'edit']]);
    /**
     * 栏目
     */
    Route::resource('column', 'ColumnController');
    /**
     * 公共下拉列表数据
     */
    Route::get('content-select-data/{categoryId}/{type?}', 'DataProviderController@getContentSelectorData');
    Route::get('category-select-data', 'DataProviderController@getCategoriesSelectorData');
    Route::get('navigation-select-data', 'DataProviderController@getNavigationSelectorData');
    Route::get('get-column','DataProviderController@getColumn');
});


/**
 * 短信发送路由
 */
Route::group(['middleware' => ['auth:api'], 'namespace' => 'Api\Admin\SMS', 'prefix' => 'sms'],function (){
    /**
    *  导入excel表
     **/
    Route::post('import-excel','SmsController@importExcel');
    Route::post('send-sms','SmsController@sendMsg');
});

